package com.packet.utils;

// 控制器类
public class AssignmentController {
    public static void main(String[] args) {
        // 创建作业模型
        AssignmentModel assignmentModel = new AssignmentModel();

        // 创建学生视图并注册为观察者
        StudentView student1 = new StudentView("学生1");
        StudentView student2 = new StudentView("学生2");

        assignmentModel.registerObserver(student1);
        assignmentModel.registerObserver(student2);

        // 设置作业并触发通知
        assignmentModel.setAssignment("数学作业下发通知");
        assignmentModel.setStatus("发布通知");

        // 可以通过其他方法修改作业状态，观察者会自动接收到通知并更新
        assignmentModel.setAssignment("数学作业提交时间延后");
        assignmentModel.setStatus("更新通知");
    }
}
